package com.iwhalecloud.bss.kite.cucc.web.service.goods.modify;


import com.iwhalecloud.bss.kite.cucc.web.service.goods.modify.impl.*;

import java.util.Arrays;

public enum GoodsModifyServiceEnum {

    /**
     * DEFAULT_GOODS_CATAGORY
     */
    DEFAULT_GOODS_CATAGORY("-1", DefaultGoodsModifyService.class),
    /**
     * DEVICE
     */
    DEVICE("2000964", DeviceGoodsModifyService.class),
    /**
     * BIGDATA
     */
    BIGDATA("2000864", OppGoodsModifyService.class),
    /**
     * BIGDATAtwo
     */
    BIGDATAtwo("2000865", OpptwoGoodsModifyService.class);
    /**
     * cateId
     */
    private String cateId;
    /**
     * clazz
     */
    private Class<? extends AbstractGoodsModifyService> clazz;

    GoodsModifyServiceEnum(String cateId, Class<? extends AbstractGoodsModifyService> clazz) {
        this.cateId = cateId;
        this.clazz = clazz;
    }

    public String getCateId() {
        return cateId;
    }

    public void setCateId(String cateId) {
        this.cateId = cateId;
    }

    public Class<? extends AbstractGoodsModifyService> getClazz() {
        return clazz;
    }

    public void setClazz(Class<? extends AbstractGoodsModifyService> clazz) {
        this.clazz = clazz;
    }

    public static GoodsModifyServiceEnum codeOf(String cateId) {
        return Arrays.stream(values()).filter(t -> t.getCateId().equals(cateId)).findAny().orElse(DEFAULT_GOODS_CATAGORY);
    }
}
